<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>属性选择器</title>
        <style>
            div[id^="title"]{color:red;}
            div[id$="title"]{color:green;}
            div[id*="title"]{background-color: pink;}
        </style>
    </head>
    <body>
       <div id="title1">title1</div>
       <div id="title2">title2</div>
       <div id="title3">title3</div>
       <div id="firsttitle">firsttitle</div>
       <div id="secondtitle">secondtitle</div>
       <div id="thirdtitle">thirdtitle</div>
    </body>
</html>